package com.skyline.spot.dao;

import java.util.List;

import com.skyline.base.type.Activity;
import com.skyline.base.type.SpotRefrenceType;
import com.skyline.common.bean.Page;
import com.skyline.spot.model.SpotRefrence;

public interface SpotRefrenceDao {

	/**
	 * 插入refrence
	 * 
	 * @param spotId
	 * @param spotName
	 * @param spotPortrait
	 * @param refrenceId
	 * @param refrencePortrait
	 *            type为photo时即该照片的地址，其所属相册为spot的默认相册，Album时为封面
	 * @param refrenceTitle
	 * @param refrenceDigest
	 * @param type
	 *            参照SpotRefrenceType
	 * @param refrenceProviderId
	 * @param refrenceProviderNickname
	 * @param refrenceProviderPortrait
	 * @param refrenceProviderEmail
	 * @return
	 */
	public Long insertRefrence(Long spotId, String spotName,
			String spotPortrait, Long refrenceId, String refrencePortrait,
			String refrenceTitle, String refrenceDigest, SpotRefrenceType type,
			Long refrenceProviderId, String refrenceProviderNickname,
			String refrenceProviderPortrait, String refrenceProviderEmail);

	/**
	 * 根据ID查找
	 * @param id
	 * @param activity
	 * @return SpotRefrence
	 */
	public SpotRefrence queryRefrenceById(Long id, Activity activity);

	/**
	 * 根据spotId查找，由于获取指定spot的所有refrence
	 * @param spotId
	 * @param activity
	 * @param page
	 * @return List
	 */
	public List<SpotRefrence> queryRefrencesBySpotId(Long spotId,
			Activity activity, Page page);

	/**
	 * 根据Type分类查找，可用于特定spot页面下的分类显示
	 * @param spotId
	 * @param type
	 * @param activity
	 * @param page
	 * @return
	 */
	public List<SpotRefrence> queryRefrencesBySpotIdAndType(Long spotId,
			SpotRefrenceType type, Activity activity, Page page);

	public List<SpotRefrence> queryRefrencesByRefrenceIdAndSpotId(
			Long refrenceId, Long spotId, Activity activity, Page page);

	/**
	 * refrence全局分类查找，可用于全局上的spot refrence分类显示
	 * @param type
	 * @param activity
	 * @param page
	 * @return
	 */
	public List<SpotRefrence> queryRefrencesByType(SpotRefrenceType type,
			Activity activity, Page page);

	public List<SpotRefrence> queryRefrencesBySpotNameAndType(String spotName,
			SpotRefrenceType type, Activity activity, Page page);

	public List<SpotRefrence> queryRefrencesByProviderIdAndSpotIdAndType(
			Long providerId, Long spotId, SpotRefrenceType type,
			Activity activity, Page page);

	public List<SpotRefrence> queryRefrencesByProviderIdAndSpotId(
			Long providerId, Long spotId, Activity activity, Page page);

	public Integer getRefrenceCountBySpotIdAndType(Long spotId,
			SpotRefrenceType type, Activity activity);

	public Integer getRefrenceCountBySpotIdAndProviderIdAndType(Long spotId,
			Long providerId, SpotRefrenceType type, Activity activity);

	public Integer getRefrenceCountBySpotIdAndProviderId(Long spotId,
			Long providerId, Activity activity);

	public void deleteRefrenceByRefrenceIdAndSpotId(Long refrenceId, Long spotId);

	public void deleteRefrenceByRefrenceIdAndSpotIdAndType(Long refrenceId,
			Long spotId, SpotRefrenceType type);

	public void deleteRefrenceByProviderIdAndSpotId(Long providerId, Long spotId);

	public void deleteRefrenceByProviderIdAndSpotIdAndType(Long providerId,
			Long spotId, SpotRefrenceType type);

	public void deleteRefrenceById(Long id);

}
